<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>儿童健康手册添加</title>

<%@ include file="/WEB-INF/component/commonCSS.jsp" %> 
<style type="text/css">
    	div.box-body {
    		margin-top:7px;
    	}
    </style>

</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>儿童健康手册新增</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="compList.jsp">健康管理</a></li>
            <li class="active"><a href="compEdit.jsp">儿童健康手册新增</a></li>
        </ol>
    </section>
    <section class="content">
      <form role="form" id="form1" class="form-horizontal" action="${ctx }/childManual/addChildManual.html" method="post">
        <div class=" box box-success">
            <!-- form start -->
                <div class="box-body">                               
                <div class="form-group form-group-xs">
                        <label class="col-sm-2 text-right">标题：</label>
                        <div class="col-sm-4 text-left">
                            <input class="form-control" id="title" name="title"  type="text">
                        </div>
                        <label class="col-sm-2 text-right">手册类型：</label>
                        <div class="col-sm-4 text-left">
                        <select class="form-control" id="mtype" name="mtype">
	                    	<option value="1">健康知识</option>
	                    	<option value="2">疾病预防</option>
	                    	<option value="3">育苗接种</option>
                    	</select>
                        
                        </div>
                   </div>
                   <div class="form-group form-group-xs">
                        <label class="col-sm-2 text-right">网址：</label>
                        <div class="col-sm-10 text-left">
                            <input class="form-control" id="url" name="url"  type="text">
                        </div>
                   </div>
                <div class="form-group form-group-xs">
                        <label class="col-sm-2 text-right">适用最小年龄：</label>
                        <div class="col-sm-4 text-left">
                            <input class="form-control" id="satart_age" name="satart_age"  type="text">
                        </div>
                        <label class="col-sm-2 text-right">适用最大年龄：</label>
                        <div class="col-sm-4 text-left">
                            <input class="form-control" id="end_age" name="end_age"  type="text">
                        </div>
                   </div>
                   
                   
                   <div class="form-group form-group-xs">
                        <label class="col-sm-2 text-right">内容：</label>
                        <div class="col-sm-10 text-left">
                            <script  id="editor"  type="text/plain" style="width:1076px;height:300px;" ></script>
                        </div>
                        
                   </div>
                    
                    <input type="hidden" name="content" id="content">
                    
                    
                    
                 <div class="box-footer text-center">
                    <button type="button" onclick="save();" class="btn btn-success btn-sm">保&nbsp;存</button>
                    <button type="button" onclick="back();" class="btn btn-danger btn-sm">返&nbsp;回</button>
                </div>
              </div>      
        </div>
       </form> 
        
        
         <%@ include file="/WEB-INF/component/commonJS.jsp" %>  
    </section>
	<script type="text/javascript">
	$(document).ready(function (){
		UE.getEditor('editor');
	})
	 
	 function save(){
   	  $.HN.message.confirm('确定要保存吗？', '', '').on(function (e) {
             if (e) {
            	 $("#content").val(UE.getEditor('editor').getContent());
            	 
            	 $('#form1').submit();
             }
         });
   }
	$('#form1').ajaxForm({ 
	    dataType: 'json', 
	    
    	success: function(returnData) {
    	if(returnData.success) {
    		$.HN.message.alert('添加成功！', '提示信息', 'success');
    	   window.location.href="${pageContext.request.contextPath }/childManual/toChildManualList.html";
		}else{
			$.HN.message.alert('添加失败，请重新添加！', '提示信息', 'success');
    	}
       } 	
   });
	
   function back(){
   	window.location.href="${pageContext.request.contextPath }/childManual/toChildManualList.html";
   }
   
   
   
   
   function editPsComp() {
		$('#editPsComp').modal({
			keyboard : true
		});
	}
   
   function selectComp(){
	   
		$("#compCode").val("");
	    $("#compName").val("");
	    gridSerch();
	   $('#selectComp').modal({
			keyboard : true
		});
	   
	   //window.open("${pageContext.request.contextPath}/stdDrug/toSelectComp.html?value=prodPompId&text=comp","newwin","dialogHeight: 200px; dialogWidth: 150px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");
   }
   function gridSerch() {
   	var compCode = $("#compCode").val();
   	var compName = $("#compName").val();
		$("#gridlist1").jqGrid('setGridParam',{  
	        datatype:'json',
	        postData:{"compCode":compCode,
	        		"compName":compName}
	    }).trigger("reloadGrid"); //重新载入  
	}
   function gridOk(){
	   var compId = $("#gridlist1").jqGrid('getGridParam', 'selrow');
       if (compId == null) {
    	   $.HN.message.alert('请至少选一行！', '提示信息', 'error');
           return;
       }
       var rowdata = $("#gridlist1").jqGrid('getRowData', compId);
       $("#prodPompId").val(compId);
       $("#comp").val(rowdata.compName);
       $("#selectComp").modal("hide");

   }
   function cleandata(){
	   $("#prodPompId").val("");
       $("#comp").val("");
       $("#selectComp").modal("hide");
   }
   
   
   function selectSpec(){
		$("#specName").val("");
	    gridSpecSerch();
	   $('#selectSpec').modal({
			keyboard : true
		});
	   //window.showModalDialog("${pageContext.request.contextPath}/stdDrug/toSelectComp.html","newwin","dialogHeight: 200px; dialogWidth: 150px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");
  }
  function gridSpecSerch() {
  	var specName = $("#specName").val();
		$("#gridlist2").jqGrid('setGridParam',{  
	        datatype:'json',
	        postData:{"specName":specName}
	    }).trigger("reloadGrid"); //重新载入  
	}
  function gridSpecOk(){
	   var specid = $("#gridlist2").jqGrid('getGridParam', 'selrow');
      if (specid == null) {
   	   $.HN.message.alert('请至少选一行！', '提示信息', 'error');
          return;
      }
      var rowdata = $("#gridlist2").jqGrid('getRowData', specid);
      $("#specId").val(specid);
      $("#txdrugspec").val(rowdata.specName);
      $("#selectSpec").modal("hide");

  }
  function cleanSpecdata(){
	   $("#specId").val("");
      $("#txdrugspec").val("");
      $("#selectSpec").modal("hide");
  }
	</script>
</body>
</html>